{% extends 'app01/admin/home.html' %}


{% block content %}
     <div class="panel panel-default">
                    <div class="panel-heading">所有普通管理员</div>
                    <div class="panel-body">
                        <table class="table-hover table table-striped tab-content">
                            <thead>
                            <tr>
                                <th>账户</th>
                                <th>邮箱</th>
                                <th>手机</th>
                            </tr>
                            </thead>
                            <tbody>
                            {% for student in c_page %}
                                <tr>
                                    <td>{{ student.username }}</td>
                                    <td>{{ student.email }}</td>
                                    <td>{{ student.phone }}</td>
                                </tr>

                            {% endfor %}

                            </tbody>
                        </table>
                    </div>
                </div>
                {# 分页显示 #}
                <div class="pager">
                    <nav aria-label="Page navigation">
                        <ul class="pagination">
                            {{ page_html }}
                        </ul>
                    </nav>
                </div>

{% endblock %}

{% block js %}
    <script>
     //修改密码的ajax请求

        $('#id_editer').click(function () {
            let old_pwd = $('#id_old_pwd').val()
            let new_pwd = $('#id_new_pwd').val()
            let comfir_pwd = $('#id_confirm_pwd').val()

            $.ajax({
                url: '/app01/set_password/',
                type: 'post',
                data: {'old_pwd': old_pwd, 'new_pwd': new_pwd, 'confirm_pwd': comfir_pwd},
                success: function (attr) {
                    if (attr.code === 1000) {
                        alert(attr.msg)
                        window.location.reload()
                    } else if (attr.code === 2000) {
                        $('#error').text(attr.msg)
                    } else if (attr.code === 3000) {
                        $('#error').text(attr.msg)
                    }
                }
            })


        });
    </script>
{% endblock %}